/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.curso.model;

/**
 *
 * @author curso
 */
public class Direccion extends BaseObject{

    private String calle;
    private int numero;
    private String ciudad;
    private String provincia;
    private String pais;
    private String codigopostal;


        /**
     * Overridden equals method for object comparison. Compares based on hashCode.
     * @param o Object to compare
     * @return true/false based on hashCode
     */
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof Direccion)) {
            return false;
        }

        final Direccion address1 = (Direccion) o;

        return this.hashCode() == address1.hashCode();
    }

    /**
     * Overridden hashCode method - compares on address, city, province, country and postal code.
     * @return hashCode
     */
    public int hashCode() {
        int result;
        result = (calle != null ? calle.hashCode() : 0);
        result = 29 * result + (numero != 0 ? numero : 0);
        result = 29 * result + (ciudad != null ? ciudad.hashCode() : 0);
        result = 29 * result + (provincia != null ? provincia.hashCode() : 0);
        result = 29 * result + (pais != null ? pais.hashCode() : 0);
        result = 29 * result + (codigopostal != null ? codigopostal.hashCode() : 0);
        return result;
    }

    /**
     * Returns a multi-line String with key=value pairs.
     * @return a String representation of this class.
     */
    public String toString() {
        return new StringBuilder()
                .append("calle: ").append( this.calle)
                .append("numero: ").append(this.numero)
                .append("ciudad: ").append( this.ciudad)
                .append("provincia: ").append( this.provincia)
                .append("pais: ").append(this.pais)
                .append("codigo postal: ").append( this.codigopostal)
                .toString();
    }

}
